<?php

/**
 * This is the model class for table "bphtb.objek_pajak".
 *
 * The followings are the available columns in table 'bphtb.objek_pajak':
 * @property string $kd_propinsi
 * @property string $kd_dati2
 * @property string $kd_kecamatan
 * @property string $kd_kelurahan
 * @property string $kd_blok
 * @property string $no_urut
 * @property string $kd_jns_op
 * @property double $hrg_taksir
 * @property string $no_sertf
 * @property integer $sts_rec
 * @property string $sts_png
 * @property string $sts_blok
 * @property string $kd_jns
 */
class ObjekPajak extends CActiveRecord {


    public $nop;
    public $nama_pemilik;
    public $alamat_pemilik;
    public $tahun_dok;
    public $nik_pemilik;   
    public $jalan_op;
    public $blok_kav_no_op;
    public $nm_kecamatan;
    public $nm_kelurahan;
    public $rt_op;
    public $rw_op;
    public $kota_wp;
    public $njop_bumi;
    public $njop_bng;
    public $total_luas_bng;
    public $tgl_pmh;
    public $no_pmh;
    public $kabupaten_wp;
    public $kabupaten_op;
    public $nm_wp;
    public $tahun;
    public $kode_jns;
    public $total_luas_bumi;
    public $nama_pmh;
    public $no_form;
    public $edTgl;
    public $edTgl2;
    public $jalan_wp;
    public $combo;
    public $fieldcari;

    /**
     * @return string the associated database table name
     */
    public function tableName() {
        return 'bphtb.objek_pajak';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules() {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('kd_propinsi, kd_dati2, kd_kecamatan, kd_kelurahan, kd_blok, no_urut, kd_jns_op', 'required'),
            array('sts_rec', 'numerical', 'integerOnly' => true),
            array('hrg_taksir', 'numerical'),
            array('kd_propinsi, kd_dati2', 'length', 'max' => 2),
            array('kd_kecamatan, kd_kelurahan, kd_blok, kd_jns', 'length', 'max' => 3),
            array('no_urut', 'length', 'max' => 4),
            array('kd_jns_op, sts_png, sts_blok', 'length', 'max' => 1),
            array('no_sertf', 'length', 'max' => 15),
            // The following rule is used by search().
            // @todo Please remove those attributes that should not be searched.
            array('kd_propinsi, kd_dati2, kd_kecamatan, kd_kelurahan, kd_blok, no_urut, kd_jns_op, hrg_taksir, no_sertf, sts_rec, sts_png, sts_blok, kd_jns', 'safe', 'on' => 'search'),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations() {
        // NOTE: you may need to adjust the relation name and the related
        // class name for the relations automatically generated below.
        return array(
        
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
        return array(
            'kd_propinsi' => 'Kd Propinsi',
            'kd_dati2' => 'Kd Dati2',
            'kd_kecamatan' => 'Kd Kecamatan',
            'kd_kelurahan' => 'Kd Kelurahan',
            'kd_blok' => 'Kd Blok',
            'no_urut' => 'No Urut',
            'kd_jns_op' => 'Kd Jns Op',
            'hrg_taksir' => 'Hrg Taksir',
            'no_sertf' => 'No Sertf',
            'sts_rec' => 'Sts Rec',
            'sts_png' => 'Sts Png',
            'sts_blok' => 'Sts Blok',
            'kd_jns' => 'Kd Jns',
        );
    }

    /**
     * Retrieves a list of models based on the current search/filter conditions.
     *
     * Typical usecase:
     * - Initialize the model fields with values from filter form.
     * - Execute this method to get CActiveDataProvider instance which will filter
     * models according to data in model fields.
     * - Pass data provider to CGridView, CListView or any similar widget.
     *
     * @return CActiveDataProvider the data provider that can return the models
     * based on the search/filter conditions.
     */
    public function search() {
        // @todo Please modify the following code to remove attributes that should not be searched.

        $criteria = new CDbCriteria;

        $criteria->compare('kd_propinsi', $this->kd_propinsi, true);
        $criteria->compare('kd_dati2', $this->kd_dati2, true);
        $criteria->compare('kd_kecamatan', $this->kd_kecamatan, true);
        $criteria->compare('kd_kelurahan', $this->kd_kelurahan, true);
        $criteria->compare('kd_blok', $this->kd_blok, true);
        $criteria->compare('no_urut', $this->no_urut, true);
        $criteria->compare('kd_jns_op', $this->kd_jns_op, true);
        $criteria->compare('hrg_taksir', $this->hrg_taksir);
        $criteria->compare('no_sertf', $this->no_sertf, true);
        $criteria->compare('sts_rec', $this->sts_rec);
        $criteria->compare('sts_png', $this->sts_png, true);
        $criteria->compare('sts_blok', $this->sts_blok, true);
        $criteria->compare('kd_jns', $this->kd_jns, true);

        return new CActiveDataProvider($this, array(
                    'criteria' => $criteria,
                ));
    }


            public function CariObjekPajak() {
        // @todo Please modify the following code to remove attributes that should not be searched.

        $criteria = new CDbCriteria;



        $criteria->select = 't.kd_propinsi||t.kd_dati2||t.kd_kecamatan||t.kd_kelurahan||t.kd_blok||t.no_urut||t.kd_jns_op as nop,
                                    c.nm_wp  AS nama_pemilik,                                  
                                    c.jalan_wp  AS alamat_pemilik,
                                    b.subjek_pajak_id AS nik_pemilik,
                                    
                                    rc.nm_kecamatan,
                                    k.nm_kelurahan,
                                    b.rt_op,
                                    b.rw_op,
                                    b.jalan_op,
                                    b.blok_kav_no_op,
                                    b.total_luas_bumi,
                                    b.njop_bumi,
                                    b.total_luas_bng,
                                    b.njop_bng,
                                    rd.nm_dati2 AS kabupaten_op,
									t.sts_blok,
                                    c.nm_wp';
       $criteria->join ='join PBB.DAT_OBJEK_PAJAK b ON t.kd_propinsi = b.kd_propinsi
	        AND t.kd_dati2 = b.kd_dati2
			AND t.kd_kecamatan = b.kd_kecamatan
			AND t.kd_kelurahan = b.kd_kelurahan
			AND t.kd_blok = b.kd_blok
			AND t.no_urut = b.no_urut
			AND t.kd_jns_op = b.kd_jns_op
        left join PBB.DAT_SUBJEK_PAJAK c ON B.SUBJEK_PAJAK_ID = c.SUBJEK_PAJAK_ID
        
        inner join pbb.ref_dati2 rd on b.kd_propinsi = rd.kd_propinsi
		LEFT JOIN pbb.ref_kecamatan rc ON t.kd_kecamatan = rc.kd_kecamatan
		LEFT JOIN pbb.ref_kelurahan k ON t.kd_kecamatan = k.kd_kecamatan AND t.kd_kelurahan = k.kd_kelurahan';
        
        
        $criteria->condition .="t.sts_blok='0'";
        $criteria->compare ('c.nm_wp', strtoUpper($this->nm_wp), true);
        $criteria->condition .="and t.kd_kecamatan='".$_GET['ObjekPajak']['kd_kecamatan']."' AND t.kd_kelurahan='".$_GET['ObjekPajak']['kd_kelurahan']."'";
    

//$criteria->compare ('d.tahun', $this->tahun, true);
    //$criteria->compare ('c.nm_wp', $this->nm_wp, true);
    
    
    if($this->nm_kecamatan !=""){
        $criteria->addCondition("rc.kecamatan='".$this->nm_kecamatan."'");
    }
    
        if($this->nm_kelurahan !=""){
        $criteria->addCondition("rc.kelurahan='".$this->nm_kelurahan."'");
    }
    
    
    //$this->nm_kecamatan = 'LINGKAS UJUNG';
    
    
    
        return new CActiveDataProvider($this, array(
                    'criteria' => $criteria,
                ));
    }



            public function CariBukaBlokir() {
        // @todo Please modify the following code to remove attributes that should not be searched.

        $criteria = new CDbCriteria;


        $criteria->select = 't.kd_propinsi||t.kd_dati2||t.kd_kecamatan||t.kd_kelurahan||t.kd_blok||t.no_urut||t.kd_jns_op as nop,
                                    c.nm_wp  AS nama_pemilik,                                  
                                    c.jalan_wp  AS alamat_pemilik,
                                    
                                    rc.nm_kecamatan,
                                    k.nm_kelurahan,
                                    b.rt_op,
                                    b.rw_op,
                                    b.jalan_op,
                                    b.blok_kav_no_op,
                                    b.total_luas_bumi,
                                    b.njop_bumi,
                                    b.total_luas_bng,
                                    b.njop_bng,
                                    rd.nm_dati2 AS kabupaten_op,
									t.sts_blok,
                                    c.nm_wp';
       $criteria->join ='join PBB.DAT_OBJEK_PAJAK b ON t.kd_propinsi = b.kd_propinsi
	        AND t.kd_dati2 = b.kd_dati2
			AND t.kd_kecamatan = b.kd_kecamatan
			AND t.kd_kelurahan = b.kd_kelurahan
			AND t.kd_blok = b.kd_blok
			AND t.no_urut = b.no_urut
			AND t.kd_jns_op = b.kd_jns_op
        left join PBB.DAT_SUBJEK_PAJAK c ON B.SUBJEK_PAJAK_ID = c.SUBJEK_PAJAK_ID
        
        inner join pbb.ref_dati2 rd on b.kd_propinsi = rd.kd_propinsi
		LEFT JOIN pbb.ref_kecamatan rc ON t.kd_kecamatan = rc.kd_kecamatan
		LEFT JOIN pbb.ref_kelurahan k ON t.kd_kecamatan = k.kd_kecamatan AND t.kd_kelurahan = k.kd_kelurahan';
        
        $criteria->condition .="t.sts_blok='1'";
        
        $criteria->compare ('c.nm_wp', strtoUpper($this->nm_wp), true);
        
        $criteria->condition .="and t.kd_kecamatan='".$_GET['ObjekPajak']['kd_kecamatan']."' AND t.kd_kelurahan='".$_GET['ObjekPajak']['kd_kelurahan']."'";
    
    
    if($this->nm_kecamatan !=""){
        $criteria->addCondition("rc.kecamatan='".$this->nm_kecamatan."'");
    }
    
        if($this->nm_kelurahan !=""){
        $criteria->addCondition("rc.kelurahan='".$this->nm_kelurahan."'");
    }


        $criteria->compare('kd_propinsi', $this->kd_propinsi, true);
        $criteria->compare('kd_dati2', $this->kd_dati2, true);
        $criteria->compare('kd_kecamatan', $this->kd_kecamatan, true);
        $criteria->compare('kd_kelurahan', $this->kd_kelurahan, true);
        $criteria->compare('kd_blok', $this->kd_blok, true);
        $criteria->compare('no_urut', $this->no_urut, true);
        $criteria->compare('kd_jns_op', $this->kd_jns_op, true);
        $criteria->compare('hrg_taksir', $this->hrg_taksir);
        $criteria->compare('no_sertf', $this->no_sertf, true);
        $criteria->compare('sts_rec', $this->sts_rec);
        $criteria->compare('sts_png', $this->sts_png, true);
        $criteria->compare('sts_blok', $this->sts_blok, true);
        $criteria->compare('kd_jns', $this->kd_jns, true);


        return new CActiveDataProvider($this, array(
                    'criteria' => $criteria,
                ));
    }


    public function searchInfoNOP() {
        // @todo Please modify the following code to remove attributes that should not be searched.

        $criteria = new CDbCriteria;
        $criteria->select = 't.kd_propinsi||t.kd_dati2||t.kd_kecamatan||t.kd_kelurahan||t.kd_blok||t.no_urut||t.kd_jns_op as nop,
                                    c.nm_wp  AS nama_pemilik,                                  
                                    c.jalan_wp  AS alamat_pemilik,
                                    rc.nm_kecamatan,
                                    k.nm_kelurahan,
                                    b.rt_op,
                                    b.rw_op,
                                    rd.nm_dati2 AS kabupaten_op,
                                    b.njop_bumi,
                                    b.njop_bng,
                                    b.total_luas_bng,
                                    b.jalan_op,
									b.blok_kav_no_op,
                                    t.sts_blok,
                                    c.nm_wp,
                                    d.tahun,
                                    c.jalan_wp
                                    ';         
        $criteria->join = "
        join PBB.DAT_OBJEK_PAJAK b ON t.kd_propinsi = b.kd_propinsi
	        AND t.kd_dati2 = b.kd_dati2
			AND t.kd_kecamatan = b.kd_kecamatan
			AND t.kd_kelurahan = b.kd_kelurahan
			AND t.kd_blok = b.kd_blok
			AND t.no_urut = b.no_urut
			AND t.kd_jns_op = b.kd_jns_op
        left join bphtb.dok_terima d on t.kd_propinsi = d.kd_propinsi
            and t.kd_dati2 = d.kd_dati2
            and t.kd_kecamatan = d.kd_kecamatan
            and t.kd_kelurahan = d.kd_kelurahan
            and t.kd_blok = d.kd_blok
            and t.no_urut = d.no_urut
            and t.kd_jns_op = d.kd_jns_op
        left join PBB.DAT_SUBJEK_PAJAK c ON B.SUBJEK_PAJAK_ID = c.SUBJEK_PAJAK_ID
        inner join pbb.ref_dati2 rd on b.kd_propinsi = rd.kd_propinsi
		LEFT JOIN pbb.ref_kecamatan rc ON t.kd_kecamatan = rc.kd_kecamatan
		LEFT JOIN pbb.ref_kelurahan k ON t.kd_kecamatan = k.kd_kecamatan AND t.kd_kelurahan = k.kd_kelurahan
        
        ";
        $criteria->condition="t.kd_kecamatan='".$_GET['ObjekPajak']['kd_kecamatan']."' AND t.kd_kelurahan='".$_GET['ObjekPajak']['kd_kelurahan']."'";
    
//		if($this->nm_wp != ""){
//			$criteria->condition .= " and c.nm_wp LIKE  '%".strtoupper($this->nm_wp)."%'";
//		}
        
		if($this->combo == "0" ){
			$criteria->condition .= " and c.nm_wp LIKE  '%".strtoupper($this->fieldcari)."%'";
		}
		else if($this->combo == "1" ){
		  
		  //t.kd_propinsi||t.kd_dati2||t.kd_kecamatan||t.kd_kelurahan||t.kd_blok||t.no_urut||t.kd_jns_op as nop,
          //64 73 010 003 002 0002 0
          if($this->fieldcari == ""){
            $criteria->condition .= " AND 1=1";
          }else{
		  $kd_propinsi = substr($this->fieldcari,0,2);
          $kd_dati2 = substr($this->fieldcari,2,2);
          $kd_kecamatan = substr($this->fieldcari,4,3);
          $kd_kelurahan = substr($this->fieldcari,7,3);
          $kd_blok = substr($this->fieldcari,10,3);
          $no_urut = substr($this->fieldcari,13,4);
          $kd_jns_op = substr($this->fieldcari,17,1);
          
		 $criteria->condition .= " AND(t.kd_propinsi ='".$kd_propinsi."' 
                                    AND t.kd_dati2 = '".$kd_dati2."' 
                                    AND t.kd_kecamatan = '".$kd_kecamatan."' 
                                    AND t.kd_kelurahan = '".$kd_kelurahan."' 
                                    AND t.kd_blok = '".$kd_blok."' 
                                    AND t.no_urut = '".$no_urut."' 
                                    AND t.kd_jns_op = '".$kd_jns_op."')"; 
		}}
        
        
//        else if($this->combo == "1"){
//            $criteria->condition .= " and c.jalan_wp LIKE  '%".strtoupper($this->fieldcari)."%'";
//        } 
        

        if($this->nm_kecamatan !=""){
            $criteria->addCondition("rc.kecamatan='".$this->nm_kecamatan."'");
        }
        
            if($this->nm_kelurahan !=""){
            $criteria->addCondition("rc.kelurahan='".$this->nm_kelurahan."'");
        }
        
        

                        
    
        return new CActiveDataProvider($this, array(
                    'criteria' => $criteria,
                ));
    }
	
    
    
       public function searchCetakInfoNJOP() {
        // @todo Please modify the following code to remove attributes that should not be searched.

        $criteria = new CDbCriteria;
        $criteria->select = 't.kd_propinsi||t.kd_dati2||t.kd_kecamatan||t.kd_kelurahan||t.kd_blok||t.no_urut||t.kd_jns_op as nop,
                                    c.nm_wp  AS nama_pemilik,
                                    c.jalan_wp  AS alamat_pemilik,
                                    c.kota_wp  AS kabupaten_wp,
                                    b.jalan_op,
                                    d.tahun as tahun_dok,
                                    rc.nm_kecamatan,
                                    k.nm_kelurahan,
                                    b.rt_op,
                                    b.rw_op,
                                    rd.nm_dati2 AS kabupaten_op,
                                    b.njop_bumi,
                                    b.njop_bng,
                                    b.total_luas_bng,
                                    p.no_pmh,
                                    b.jalan_op,b.blok_kav_no_op,
                                    p.nama_pmh,
                                    p.tgl_pmh
                                    
                                    ';
        $criteria->join = "
        inner join PBB.DAT_OBJEK_PAJAK b ON t.kd_propinsi = b.kd_propinsi
            AND t.kd_dati2 = b.kd_dati2
        	AND t.kd_kecamatan = b.kd_kecamatan
        	AND t.kd_kelurahan = b.kd_kelurahan
        	AND t.kd_blok = b.kd_blok
        	AND t.no_urut = b.no_urut
        	AND t.kd_jns_op = b.kd_jns_op
        inner join PBB.DAT_SUBJEK_PAJAK c ON B.SUBJEK_PAJAK_ID = c.SUBJEK_PAJAK_ID
        inner join bphtb.dok_terima d on t.kd_propinsi = d.kd_propinsi
            			AND t.kd_dati2 = d.kd_dati2
            			AND t.kd_kecamatan = d.kd_kecamatan
            			AND t.kd_kelurahan = d.kd_kelurahan
            			AND t.kd_blok = d.kd_blok
            			AND t.no_urut = d.no_urut
            			AND t.kd_jns_op = d.kd_jns_op
        LEFT JOIN pbb.ref_kecamatan rc ON t.kd_kecamatan = rc.kd_kecamatan
		LEFT JOIN pbb.ref_kelurahan k ON t.kd_kecamatan = k.kd_kecamatan AND t.kd_kelurahan = k.kd_kelurahan
        inner join pbb.ref_dati2 rd on t.kd_dati2 = b.kd_dati2
        inner join bphtb.pemohon p on d.no_reg = p.no_reg
        ";
        $criteria->condition = "1=1";
		if($this->edTgl != "" && $this->edTgl2 != ""){
			$criteria->condition .= " and p.tgl_pmh  BETWEEN '".HelperUtils::tglToDb($this->edTgl)."' AND '".HelperUtils::tglToDb($this->edTgl2)."' ";
		}

        $criteria->compare('nama_pmh', $this->nama_pmh, true);
        
        
//		if($this->nama_pmh != ""){
//			$criteria->condition .= " and p.nama_pmh LIKE  '%".strtoupper($this->nama_pmh)."%'";
//		}
        return new CActiveDataProvider($this, array(
                    'criteria' => $criteria,
                ));
    }

        public function searchCetakOpNJOP() {
        // @todo Please modify the following code to remove attributes that should not be searched.

        $criteria = new CDbCriteria;
        $criteria->select = 't.kd_propinsi||t.kd_dati2||t.kd_kecamatan||t.kd_kelurahan||t.kd_blok||t.no_urut||t.kd_jns_op as nop,
                                    c.nm_wp  AS nama_pemilik,
                                    c.jalan_wp  AS alamat_pemilik,
                                    c.kota_wp  AS kabupaten_wp,
                                    b.jalan_op,
                                    d.tahun as tahun_dok,
                                    rc.nm_kecamatan,
                                    k.nm_kelurahan,
                                    b.rt_op,
                                    b.rw_op,
                                    rd.nm_dati2 AS kabupaten_op,
                                    b.njop_bumi,
                                    b.njop_bng,
                                    b.total_luas_bng,
                                    p.no_pmh,
                                    b.jalan_op,b.blok_kav_no_op,
                                    p.nama_pmh,
                                    p.tgl_pmh
                                    
                                    ';
        $criteria->join = "
        inner join PBB.DAT_OBJEK_PAJAK b ON t.kd_propinsi = b.kd_propinsi
            AND t.kd_dati2 = b.kd_dati2
        	AND t.kd_kecamatan = b.kd_kecamatan
        	AND t.kd_kelurahan = b.kd_kelurahan
        	AND t.kd_blok = b.kd_blok
        	AND t.no_urut = b.no_urut
        	AND t.kd_jns_op = b.kd_jns_op
        inner join PBB.DAT_SUBJEK_PAJAK c ON B.SUBJEK_PAJAK_ID = c.SUBJEK_PAJAK_ID
        inner join bphtb.dok_terima d on t.kd_propinsi = d.kd_propinsi
            			AND t.kd_dati2 = d.kd_dati2
            			AND t.kd_kecamatan = d.kd_kecamatan
            			AND t.kd_kelurahan = d.kd_kelurahan
            			AND t.kd_blok = d.kd_blok
            			AND t.no_urut = d.no_urut
            			AND t.kd_jns_op = d.kd_jns_op
        LEFT JOIN pbb.ref_kecamatan rc ON t.kd_kecamatan = rc.kd_kecamatan
		LEFT JOIN pbb.ref_kelurahan k ON t.kd_kecamatan = k.kd_kecamatan AND t.kd_kelurahan = k.kd_kelurahan
        inner join pbb.ref_dati2 rd on t.kd_dati2 = b.kd_dati2
        inner join bphtb.pemohon p on d.no_reg = p.no_reg
        ";
        $criteria->condition = "1=1";
		if($this->edTgl != "" && $this->edTgl2 != ""){
			$criteria->condition .= " and p.tgl_pmh  BETWEEN '".HelperUtils::tglToDb($this->edTgl)."' AND '".HelperUtils::tglToDb($this->edTgl2)."' ";
		}

        $criteria->compare('nama_pmh', $this->nama_pmh, true);
        
        
//		if($this->nama_pmh != ""){
//			$criteria->condition .= " and p.nama_pmh LIKE  '%".strtoupper($this->nama_pmh)."%'";
//		}
        return new CActiveDataProvider($this, array(
                    'criteria' => $criteria,
                ));
    }
    
    
 
 	public function updateEntryPmh()
	{
		
                $criteria=new CDbCriteria;

                $criteria->alias= "o";
                $criteria->select= 'o.kd_propinsi||o.kd_dati2||o.kd_kecamatan||o.kd_kelurahan||o.kd_blok||o.no_urut||o.kd_jns_op as nop,
                                    p.no_pmh,
									d.no_bayar,
									d.kode_user,
                                    d.kode_jns,
                                    d.no_form,
									p.noreg_njop,
                                    pd2.nm_dati2 AS kabupaten_op,
                                    rc.nm_kecamatan,
                                    k.nm_kelurahan,
                                    pop.rt_op,
                                    pop.rw_op,
                                    pop.jalan_op,
                                    pop.subjek_pajak_id,
                                    pop.total_luas_bumi,
                                    pop.njop_bumi,
                                    pop.total_luas_bng,
                                    pop.njop_bng,
                                    s.nm_wp AS nama_pemilik,
                                    s.jalan_wp AS alamat_pemilik,
                                    s.kota_wp AS kabupaten_wp,
                                    p.tahun as tahun_dok,
									d.nik,
									p.nama_pmh,
                                    p.alamat_pmh,
                                    p.npwp,
									p.tgl_pmh
                                    ';
            $criteria->join =" 
            inner join bphtb.dok_terima d on d.kd_propinsi = o.kd_propinsi
            			AND d.kd_dati2 = o.kd_dati2
            			AND d.kd_kecamatan = o.kd_kecamatan
            			AND d.kd_kelurahan = o.kd_kelurahan
            			AND d.kd_blok = o.kd_blok
            			AND d.no_urut = o.no_urut
            			AND d.kd_jns_op = o.kd_jns_op
            inner join pbb.dat_objek_pajak pop on d.kd_propinsi = pop.kd_propinsi
                        AND d.kd_dati2 = pop.kd_dati2
                        AND d.kd_kecamatan = pop.kd_kecamatan
                        AND d.kd_kelurahan = pop.kd_kelurahan
                        AND d.kd_blok = pop.kd_blok
                        AND d.no_urut = pop.no_urut
                        AND d.kd_jns_op = pop.kd_jns_op
            left join pbb.dat_subjek_pajak s on pop.subjek_pajak_id = s.subjek_pajak_id
		    LEFT JOIN pbb.ref_kecamatan rc ON o.kd_kecamatan = rc.kd_kecamatan
		    LEFT JOIN pbb.ref_kelurahan k ON o.kd_kecamatan = k.kd_kecamatan AND o.kd_kelurahan = k.kd_kelurahan
	        inner join pbb.ref_dati2 pd2 on pd2.kd_propinsi = pop.kd_propinsi
	        inner join bphtb.pemohon p on p.no_reg = d.no_reg";

        $criteria->compare('nama_pmh', strtoupper($this->nama_pmh), true);
//        
//            if($this->nama_pmh !=""){
//        $criteria->condition .= "p.nama_pmh = '".HelperUtils::tglToDb($this->nama_pmh)."'";
//    }
        
        
		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

 
    

    /**
     * Returns the static model of the specified AR class.
     * Please note that you should have this exact method in all your CActiveRecord descendants!
     * @param string $className active record class name.
     * @return ObjekPajak the static model class
     */
    public static function model($className = __CLASS__) {
        return parent::model($className);
    }

}
